<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>vue 组件嵌套</title>
</head>
<style>
    .template {
        margin: 5% 10%;
    }
</style>
<body>
<div id="app">
    <div class="template">
        <html-component1></html-component1>
        <html-component2></html-component2>
    </div>
</div>

<script src="../js/vue.js"></script>
<script>

    const message = {
        text: '请输入身份号',
    };


    const vue_extentd2_child = {
        data(){
            return {
                message : 'vue_extentd2_child局部组件'
            }
        },
        template : `
          <h4>
              这是{{message}}
          </h4>
        `,
    }

    const vue_extend1 = {
        data() {
            return {
                message: '这是vue_extend1组件'
            }
        },
        template: `
          <div>
          <h3>
            组件注册
          </h3>
          <p>{{ message }}</p>
          <extend1-child></extend1-child>
          </div>
        `,
        components: {
            'extend1-child': {
                template : `
                <h4>
                    这是extend1的子组件
                </h4>
                `
            }
        }
    }
    const vue_extend2 = {
        data() {
            return {
                message: '这是vue_extend2组件'
            }
        },
        template: `
          <div>
          <h3>
            组件注册
          </h3>
          <p>{{ message }}</p>
          <exend2-child></exend2-child>
          </div>
        `,
        components: {
            'exend2-child' : vue_extentd2_child,
        },
    }

    const demo = new Vue({
        el: '#app',
        data: message,
        methods: {},
        computed: {},
        components: {
            'html-component1': vue_extend1,
            'html-component2': vue_extend2,
        }
    });
</script>
</body>
</html>